<!DOCTYPE HTML>
<html>
<head>
<title>个人博客</title>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="images/favicon.ico" >
<LINK rel="Shortcut Icon" href="images/favicon.ico" />

<link rel="stylesheet" type="text/css" href="plugin/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="plugin/Hui-iconfont/1.0.8/iconfont.min.css" />
<link rel="stylesheet" type="text/css" href="css/commons.css" />
<link rel="stylesheet" type="text/css" href="plugin/pifu/pifu.css" />
<link rel="stylesheet" type="text/css" href="plugin/wangEditor/css/wangEditor.min.css">
	<script src="js/jquery-3.3.1.min.js"></script>

<script type="application/x-javascript">
	addEventListener("load", function() {
	    setTimeout(hideURLbar, 0);
	    }, false);
	function hideURLbar(){
	    window.scrollTo(0,1);
	} function showSide(){
	    $('.navbar-nav').toggle();
	}
</script>
    <script>
        $(function () {
            //查询是否登录
            $.ajax({
                url:"/CustomersSession",
                type:"post",
                dataType:"text",
                data:"",
                success:function (data) {
                    if(data!=""&&data!=null)
                    {
                        $("#login").text(data);
                    }
                },
                error:function (data) {
                    console.log("错误"+data.status);
                }
            });
            //登录
            $("#login").click(function () {
                if ($(this).text() === "未登录") {
                    location.href = "/login.html";
                } else {
                    //个人中心
                    //alert($(this).text());
                    $("#modal-demo").modal("show")
                }
            });
            //加载时先绑定用户信息
            $.ajax({
                url: "/SelectUserName",
                type: "post",
                dataType: "json",
                data: "",
                success: function (data) {
                    console.log(data.name);
                    $("#User_Name").val(data.name);
                    $("#User_email").val(data.email);
                    $("#User_address").val(data.address);
                    $("#User_occupation").val(data.occupation);
                    $("#User_telephone").val(data.telephone);
                    $("input[type=radio][name=sex][value="+data.sex+"]").attr("checked", true);
                }, error: function (data) {
                    console.log("错误" + data.status);
                }
            });
            //绑定日志信息
            $.ajax({
                url:"/QueryJournalId",
                type:"post",
                dataType:"json",
                data:{id:getQueryString("id")},
                success:function (data) {
                    $("#crumbs").text(data.title);
                    $(".c_titile").text(data.title);
                    $(".d_time").text("发布时间:"+changeDateFormat(data.time));
                    $("#author").text(data.username);
                    $("#hits").text("阅读:"+data.hits);
                    $("#content").text(data.content);
                },
                error:function (data) {
                console.log("错误"+data.status);
                }
            });
            //分页信息
            //上一条
            $.ajax({
                url:"/SelectJournalPagingUpper",
                type:"post",
                dataType:"json",
                data:{id:getQueryString("id")},
                success:function (data) {
                    if(data!=null && data!="")
                    {
                        $("#paging").append(' <p class="last">上一篇：<a href="article_detail.html?id='+data.id+'">'+data.title+'</a></p>');
                    }

                },error:function (data) {
                    console.log("错误"+data.status);
                }
            });
            //下一条
            $.ajax({
                url:"/SelectJournalPagingLower",
                type:"post",
                dataType:"json",
                data:{id:getQueryString("id")},
                success:function (data) {
                    if(data!=null && data!="")
                    {
                        $("#paging").append('<p class="next">下一篇：<a href="article_detail.html?id='+data.id+'">'+data.title+'</a></p>');
                    }

                },error:function (data) {
                    console.log("错误"+data.status);
                }
            });
            //评论量排行
            $.ajax({
                url:"/SelectJournalCommentolume",
                type:"post",
                dataType:"json",
                data:"",
                success:function (data) {
                    for(var i=0;i<data.length;i++)
                    {
                        $("#commentolume ul").append('<li>' +
                            '<a href="article_detail.html?id='+data[i].id+'">'+data[i].title+'</a>' +
                            '<p class="hits"><i class="Hui-iconfont" title="评论量">&#xe622;</i> '+data[i].commentolume+'</p>' +
                            '</li>');
                    }

                },
                error:function (data) {
                    console.log("错误"+data.status);
                }
            });

            CommentAreafun();
        });
        //修改密码信息
        function fun() {
            if ($("#User_password").val() !== $("#User_NewPassword").val()) {
                $("#error").text("两次密码不一致");
                return;
            } else {
                $("#error").text("");


                if ($("#User_password").val() !== "") {
                    //保存修改密码
                    $.ajax({
                        url: "/UpdateUserPassword",
                        type: "post",
                        dataType: "text",
                        data: {
                            OriginalPassword: $("#User_Ypassword").val(),
                            NewPassword: $("#User_password").val()
                        },
                        success: function (data) {
                            if (data == "ok") {
                                // alert("密码修改成功，请重新登录");
                                //
                                UpdateUser();
                                //location.href = "/login.html";
                            } else {
                                $("#error").text(data.toString());
                                return;
                            }
                        },
                        error: function (data) {
                            alert("错误" + data.status);
                        }

                    });
                }else
                {
                    UpdateUser();
                }

            }

        };

        //修改信息
        function UpdateUser() {
            $.ajax({
                url: "/UpdateUser",
                type: "post",
                dataType: "text",
                data: {
                    name: $("#User_Name").val(),
                    sex: $('input:radio[name="sex"]:checked').val(),
                    email: $("#User_email").val(),
                    address: $("#User_address").val(),
                    occupation: $("#User_occupation").val(),
                    telephone: $("#User_telephone").val()
                },
                success: function (data) {
                    if (data === "ok") {
                        alert("修改成功");
                        $("#modal-demo").modal("hide");
                        $("#User_Ypassword").val("")
                        $("#User_password").val("")
                        $("#User_NewPassword").val("")

                    } else {
                        $("#error").text(data.toString());
                    }
                },
                error: function (data) {
                    alert("错误" + data.status);
                }

            });
        };
        //发表文章评论
        function getPlainTxt() {
            //先判断是否登录
            if($("#login").text()==="未登录")
            {
                location.href="/login.html";
            }
            if($("#textarea1").val()==" ")
            {
                alert("请输入内容")
                return;
            }
            //console.log($("#textarea1").val())
            $.ajax({
                url:"/AddComment",
                type:"post",
                dataType:"text",
                data:{
                    reviewarticles:getQueryString("id"),
                    comments:$("#textarea1").val()
                },
                success:function(data){
                    if(data=="ok")
                    {
                        $("#textarea1").val("");
                        CommentAreafun();

                    }else
                    {
                        alert("评论失败");
                    }
                },
                error:function (data) {
                    console.log("错误"+data.status);
                }
            })

        };
        //查看文章评论
        function CommentAreafun() {
            $.ajax({
                url:"/SelectJournalIdCommentAll",
                type:"post",
                dataType:"json",
                data:{id:getQueryString("id")},
                success:function (data) {
                    $("#CommentArea ul").find("li").remove();
                    for(var i=0;i<data.length;i++)
                    {
                        $("#CommentArea ul").append('<li class="item cl">' +
                            '<a href="#">' +
                            '<i class="avatar size-L radius">' +
                            '<img alt="" src="http://qzapp.qlogo.cn/qzapp/101388738/696C8A17B3383B88804BA92ECBAA5D81/100">' +
                            '</i>' +
                            '</a>' +
                            '<div class="comment-main">' +
                            '<header class="comment-header">' +
                            '<div class="comment-meta"><a class="comment-author" href="#">'+data[i].username+'</a>' +
                            '<time title="'+changeDateFormat(data[i].time)+'" datetime="2014-08-31T03:54:20" class="f-r">'+changeDateFormat(data[i].time)+'</time>' +
                            '</div>' +
                            '</header>' +
                            ' <div class="comment-body">' +
                            '<p>'+data[i].comments+'</p>' +
                            '</div>' +
                            '</div>' +
                            '</li>');
                    }
                },
                error:function (data) {
                    console.log("错误"+data.status);
                }
            })
        };
        //获取url参数
        function getQueryString(name) {
            var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
            var r = window.location.search.substr(1).match(reg);
            if (r != null) {
                return unescape(r[2]);
            }
            return null;
        };
        //转换日期格式(时间戳转换为datetime格式)
        function changeDateFormat(cellval) {
            var dateVal = cellval + "";
            if (cellval != null) {
                var date = new Date(parseInt(dateVal.replace("/Date(", "").replace(")/", ""), 10));
                var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
                var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
                var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
                var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
                var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
                return date.getFullYear() + "-" + month + "-" + currentDate + " " + hours + ":" + minutes + ":" + seconds;
            }
        };
    </script>
</head>
<body>
<header class="navbar-wrapper">
    <div class="navbar navbar-fixed-top">
        <div class="container cl">
            <a class="navbar-logo hidden-xs" href="index.html">
                <img class="logo" src="images/logo.png" alt="Lao王博客" />
            </a>
            <a class="logo navbar-logo-m visible-xs" href="index.html">Lao王博客</a>
            <a aria-hidden="false" class="nav-toggle Hui-iconfont visible-xs" href="javascript:void(0);" onclick="showSide();">&#xe667;</a>
            <nav class="nav navbar-nav nav-collapse w_menu" role="navigation">
                <ul class="cl">
                    <li class="active"> <a href="index.html" data-hover="首页">首页</a> </li>
                    <li> <a href="about.html" data-hover="关于我">关于我</a> </li>
                    <li> <a href="mood.html" data-hover="碎言碎语">碎言碎语</a> </li>
                    <li><a href="article.html" data-hover="学无止尽">学无止尽</a></li>
                    <li> <a href="board.html" data-hover="留言板">留言板</a> </li>
                </ul>
            </nav>
            <nav class="navbar-nav navbar-userbar hidden-xs hidden-sm " style="top: 0;">
                <ul class="cl">
                    <li class="userInfo dropDown dropDown_hover">
                            <!--<a href="javascript:;" ><img class="avatar radius" src="images/40.jpg" alt="丶似浅 "></a>
                            <ul class="dropDown-menu menu radius box-shadow">
                                <li><a href="/app/loginOut">退出</a></li>
                            </ul>-->
                        <a href="#" id="login">未登录</a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</header>

<!--导航条-->
<nav class="breadcrumb">
  <div class="container">
	  <i class="Hui-iconfont">&#xe67f;</i>
	  <a href="index.html" class="c-primary">首页</a>
	  <span class="c-gray en">&gt;</span>
	  <span class="c-gray">文章</span>
	  <span class="c-gray en">&gt;</span>
	  <span class="c-gray" id="crumbs">个人博客应该选择什么样的域名和域名后缀</span>
  </div>
</nav>

<section class="container pt-20">
	<div class="row w_main_row">
				<div class="col-lg-9 col-md-9 w_main_left">
					<div class="panel panel-default  mb-20">
						<div class="panel-body pt-10 pb-10">
							<h2 class="c_titile">我的个人博客之——阿里云空间选择</h2>
							<p class="box_c"><span class="d_time">发布时间：2017-02-05</span><span>编辑：<a href="mailto:XXX" id="author">wilco</a></span><span id="hits">阅读（88646）</span></p>
							<ul class="infos">
                                <p id="content"></p>
								      <!--<p>之前服务器放在电信机房， 联通用户访问速度很不稳定，经常出现访问速度慢的问题，换到阿里云解决了之前的问题。很多人都问我的博客选得什么空间，一年的费用得多少钱，今天我列个表出来，供大家参考。</p>-->
								<!--<p>&nbsp;<img src="temp/at1.png" alt="个人博客阿里云空间选择" width="700" height="886"></p>-->
								<!--<p>对于访问量不大，小型网站带宽可以选择1M的，每个月<span class="cny" style="margin: 0px 1px; padding: 0px; border: 0px; font-family: Arial; line-height: 20px; font-size: 20px; vertical-align: baseline; color: rgb(255, 102, 0); white-space: nowrap;">¥</span><span class="money" style="margin: 0px; padding: 0px; border: 0px; font-family: 微软雅黑, 'Microsoft Yahei', 'Hiragino Sans GB', tahoma, arial, 宋体; line-height: 20px; font-size: 20px; vertical-align: baseline; color: rgb(255, 102, 0); white-space: nowrap;">56.80</span>一年也就568块钱，每天投入也就不到2块钱。</p>-->
								<!--<p><img src="temp/at2.png" alt="个人博客阿里云空间选择"></p>-->
								<!--<p><strong>1、为什么选Linux？</strong></p>-->
								<!--<p>程序用PHP，速度快，配置低（windows必选1G的内存Linux选512MB能同样达到要求）。Linux的系统安全性非常高。Linux服务器的维护与扩展到性价比和性能都高于Windows。</p>-->
								<!--<p>1) 最流行的服务器端操作系统，强大的安全性和稳定性</p>-->
								<!--<p>2) 免费且开源，轻松建立和编译源代码</p>-->
								<!--<p>3) 通过SSH方式远程访问您的云服务器</p>-->
								<!--<p>4) 一般用于高性能web等服务器应用，支持常见的PHP/Python等编程语言，支持MySQL等数据库（需自行安装)</p>-->
								<!--<p><strong>2、操作系统为什么选CentOS 安全加固版（推荐）？</strong></p>-->
								<!--<p>在原 CentOS镜像的基础上，系统进一步安全加固，安装了阿里云独有的入侵防御系统，系统中会出现aegis进程，该系统增加了实时后门，Webshell检测，更加智能的暴力破解防御和多种入侵行为监控，让服务器更加安全可靠。</p>-->
								<!--<p><a href="http://www.aliyun.com/product/ecs" target="_blank"><strong><span style="color: rgb(0, 0, 255);">前往阿里云官网购买&gt;&gt;</span></strong></a></p>-->
								<!--<p>&nbsp;</p><p align="center" class="pageLink"></p>-->
								
							</ul>

							<div class="keybq">
						    	<p><span>关键字</span>：<a class="label label-default">个人博客</a></p>
						    </div>
							<div class="nextinfo" id="paging">
								<!--<p class="last">上一篇：<a href="#">免费收录网站搜索引擎登录口大全</a></p>-->
								<!--<p class="next">下一篇：<a href="#">javascript显示年月日时间代码</a></p>-->
						    </div>
							
						</div>
					</div>
					
					<div class="panel panel-default  mb-20">
						<div class="tab-category">
                <a href=""><strong>评论区</strong></a>
            </div>
						<div class="panel-body">
                            <div class="panel-body" style="margin: 0 3%;">
                    <div class="mb-20" id="CommentArea">
                    	<ul class="commentList">
                            <!--<li class="item cl">-->
                                <!--<a href="#">-->
                                    <!--<i class="avatar size-L radius">-->
                                        <!--<img alt="" src="http://qzapp.qlogo.cn/qzapp/101388738/696C8A17B3383B88804BA92ECBAA5D81/100">-->
                                    <!--</i>-->
                                <!--</a>-->
                                <!--<div class="comment-main">-->
                                    <!--<header class="comment-header">-->
                                        <!--<div class="comment-meta"><a class="comment-author" href="#">XXX</a>-->
                                            <!--<time title="2014年8月31日 下午3:20" datetime="2014-08-31T03:54:20" class="f-r">2014-8-31 15:20</time>-->
                                        <!--</div>-->
                                    <!--</header>-->
                                    <!--<div class="comment-body">-->
                                        <!--<p> +1</p>-->
                                    <!--</div>-->
                                <!--</div>-->
                            <!--</li>-->

                        </ul>
    
                    </div>
                    <div class="line"></div>
                    <!--用于评论-->
                    <div class="mt-20" id="ct">
                        <div id="err" class="Huialert Huialert-danger hidden radius">成功状态提示</div>
                        <textarea id="textarea1" name="comment" style="height:200px;" placeholder="看完不留一发?"> </textarea>
                        <div class="text-r mt-10">
                            <button onclick="getPlainTxt()" class="btn btn-primary radius" > 发表评论</button>
                        </div>
                    </div>
                    <!--用于回复-->
                    <div class="comment hidden mt-20">
                        <div id="err2" class="Huialert Huialert-danger hidden radius">成功状态提示</div>
                            <textarea class="textarea" style="height:100px;" > </textarea>
                            <button onclick="hf(this);" type="button" class="btn btn-primary radius mt-10">回复</button>
                            <a class="cancelReply f-r mt-10">取消回复</a>
                    </div>

                </div>
                        </div>
					</div>
				</div>
				<div class="col-lg-3 col-md-3">
					<!--热门推荐-->
  	<div class="bg-fff box-shadow radius mb-20">
			<div class="tab-category">
				<a href=""><strong>热门推荐</strong></a>
			</div>
			<div class="tab-category-item" id="commentolume">
				<ul class="index_recd">
					<!--<li>-->
						<!--<a href="#">阻止a标签href默认跳转事件</a>-->
						<!--<p class="hits"><i class="Hui-iconfont" title="点击量">&#xe622;</i> 276 </p>-->
					<!--</li>-->

				</ul>
			</div>
		</div>
						
					<!--图片-->
		<!--<div class="bg-fff box-shadow radius mb-20">-->
			<!--<div class="tab-category">-->
				<!--<a href=""><strong>扫我关注</strong></a>-->
			<!--</div>-->
			<!--<div class="tab-category-item">-->
				<!--<img data-original="temp/gg.jpg" class="img-responsive lazyload" alt="响应式图片">-->
			<!--</div>-->
		<!--</div>-->
					
				</div>
			</div>
	
</section>
<footer class="footer mt-20">
		<p>Copyright &copy;2017 wfyvv.com All Rights Reserved. <br>
		</p>
</footer>
<div id="modal-demo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content radius">
            <div class="modal-header">
                <h3 class="modal-title">修改个人信息</h3>
                <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void(0);">×</a>
            </div>
            <div class="modal-body">
                <!--p>对话框内容…</p>-->
                <form action="" method="post" class="form form-horizontal" id="demoform-1">
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">昵称：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" autocomplete="off" placeholder="昵称" id="User_Name">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">性别：</label>
                        <div class="formControls skin-minimal col-xs-8 col-sm-9">
                            <div class="radio-box">
                                <input type="radio" id="sex-1" name="sex" value="1" checked>
                                <label for="sex-1">男</label>
                            </div>
                            <div class="radio-box">
                                <input type="radio" id="sex-0" name="sex" value="0">
                                <label for="sex-0">女</label>
                            </div>
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">邮箱：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" autocomplete="off" placeholder="邮箱" id="User_email">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">地址：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" autocomplete="off" placeholder="地址" id="User_address">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">职业：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" autocomplete="off" placeholder="职业"
                                   id="User_occupation">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">联系方式：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" autocomplete="off" placeholder="联系方式"
                                   id="User_telephone">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">原密码：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="password" class="input-text" autocomplete="off" placeholder="原密码"
                                   id="User_Ypassword">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">新密码：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="password" class="input-text" autocomplete="off" placeholder="新密码"
                                   id="User_password">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">确认密码：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="password" class="input-text" autocomplete="off" placeholder="再次输入新密码"
                                   id="User_NewPassword">
                            <span style="color: red" id="error"></span>
                        </div>
                    </div>
                </form>

            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" onclick="fun();">确定</button>
                <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="plugin/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="plugin/layer/3.0/layer.js"></script>
<script type="text/javascript" src="plugin/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="plugin/pifu/pifu.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script> $(function(){ $(window).on("scroll",backToTopFun); backToTopFun(); }); </script>
<script type="text/javascript" src="plugin/wangEditor/js/wangEditor.min.js"></script>
<script type="text/javascript">
    $(function () {
    		$("img.lazyload").lazyload({failurelimit : 3});
    	
        wangEditor.config.printLog = false;
        var editor1 = new wangEditor('textarea1');
        editor1.config.menus = ['insertcode', 'quote', 'bold', '|', 'img', 'emotion', '|', 'undo', 'fullscreen'];
        editor1.config.emotions = { 'default': { title: 'XXX表情', data: 'plugin/wangEditor/emotions1.data'}, 'default2': { title: 'XXX心情', data: 'plugin/wangEditor/emotions3.data'}, 'default3': { title: '顶一顶', data: 'plugin/wangEditor/emotions2.data'}};
        editor1.create();

        //show reply
        $(".hf").click(function () {
            pId = $(this).attr("name");
            $(this).parents(".commentList").find(".cancelReply").trigger("click");
            $(this).parent(".comment-body").append($(".comment").clone(true));
            $(this).parent(".comment-body").find(".comment").removeClass("hidden");
            $(this).hide();
        });
        //cancel reply
        $(".cancelReply").on('click',function () {
            $(this).parents(".comment-body").find(".hf").show();
            $(this).parents(".comment-body").find(".comment").remove();
        });
    });

</script>
</body>
</html>
